import { createApp } from "vue";
import App from "./App.vue";

import { createStore } from "./vuex/store";

// 创建一个新的 store 实例
const store = createStore({
  state() {
    return {
      count: 0,
      userinfo: {
        name: "张三",
        age: 22,
      },
    };
  },
  mutations: {
    increment(state, payload = 1) {
      state.count += payload;
    },
    changeUserinfo(state, payload) {
      state.userinfo = {
        ...state.userinfo,
        ...payload,
      };
    },
  },
});

createApp(App).use(store).mount("#app");
